﻿using System;
using System.Collections.Generic;
using System.Text;
using PMS.EntityQuery;
using PMS.BusinessFacade;
using PMS.EntityManage;
using PMS.Common;
using System.Data.SqlClient;

namespace EntityManage
{
    public class BusinessManage
    {
        public static string GetFlowStepsSql(int flowId, int isEnable, Sys_UserQuery userQuery)
        {
            string whereSql = " Flow_ID = " + flowId + " and IsEnable = " + isEnable + " and (";
            whereSql += "(Approve_Way = 0 and Role_ID in (" + userQuery.Roles + ")) ";
            whereSql += "or (Approve_Way = 1 and Org_ID = " + (userQuery.Org_ID2 == null || userQuery.Org_ID2 == 0 ? userQuery.Org_ID : userQuery.Org_ID2) + ")";
            whereSql += " or (Approve_Way = 2 and User_ID = " + userQuery.ID + ")";
            whereSql += ")";

            return whereSql;
        }

        
    }
}
